/*
 * @Description: 
 * @Author: changqing
 * @Date: 2021-08-30 16:46:49
 * @LastEditTime: 2021-08-30 16:46:49
 * @LastEditors: changqing
 * @Usage: 
 */

var { timer, interval,range,from } = require('rxjs'); 
var {distinctUntilKeyChanged,map} = require('rxjs/operators');

const students = [
  { id: 1, score: 70 },
  { id: 1, score: 80 },
  { id: 2, score: 90 },
  { id: 3, score: 100 }
];
from(students).pipe(
  distinctUntilKeyChanged('id')
)
.subscribe(student => {
  console.log(
    `${student.id} - ${student.score}`
  );
});
// 1 - 70
// 2 - 90
// 3 -100